package org.databandtech.clickhouse;

/*
 * insert into SNM_merger 
SELECT
    toDate(EventTime) AS d,
    Source,
    Uid,
    Vid,
    min(EventTime) AS From,
    max(EventTime) AS To,
    count() AS Heart_count,
    sum(Duration) AS Total_duration
FROM SNM_initial20210916
WHERE (d = toDate(yesterday())) AND (Uid != 0) AND (Vid != '0')
GROUP BY
    Source,
    Uid,
    Vid,
    d;
    
    CREATE MATERIALIZED VIEW mview_merge 
TO SNM_merger
AS 
 SELECT
    toDate(EventTime) AS d,
    Source,
    Uid,
    Vid,
    min(EventTime) AS From,
    max(EventTime) AS To,
    count() AS Heart_count,
    sum(Duration) AS Total_duration
FROM SNM_initial20210916
WHERE (d = toDate(Now())) AND (Uid != 0) AND (Vid != '0')
GROUP BY
    Source,
    Uid,
    Vid,
    d;
 */
public class SinkToMergeTable {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
